{% extends "../main.html" %}
{% block head_js %}
<!--link href="http://cdn.datatables.net/1.10.0/css/jquery.dataTables.css" rel="stylesheet"-->
<link href="{{ static_url('datatable/jquery.dataTables.css') }}" rel="stylesheet">

{% end %}

{% block bodyy %}
<div class="panel panel-primary">
    <!--div class="panel-heading">
      <h3 class="panel-title">用户日志</h3>
    </div-->
    <div class="panel-body">
        <form action="/logs" method="post">
            <table>
                <tr>
                    <td><input type="datetime" class="form-control" onClick="WdatePicker()" placeholder="开始时间" name="stime" value="{{stime}}"></td>
                    <td>至</td>
                    <td><input type="datetime" class="form-control" onClick="WdatePicker()" placeholder="结束时间" name="dtime" value="{{dtime}}"></td>
                    <td>
                        <button class="btn btn-primary" type="submit" name="cmd" value="serach">查询</button>
                    </td>
                </tr>
            </table>
        </form>

    </div>
</div>
<h3 class="sub-header"></h3>
    <table id="example" class="table table-condensed table-responsive">
        <thead>
        <tr>
            <th>日期</th>
            <th>客户端IP</th>
            <th>UID</th>
            <th>用户或账号</th>
            <th>类型</th>
            <th>操作状态</th>
            <th>备注</th>
        </tr>
        </thead>
        <tbody>
        {% for i in data %}
        <tr>
            <!--td>{{i[0]}}</td-->
            <td>{{i[6]}}</td>
            <td>{{i[7]}}</td>
            <td>{{i[1]}}</td>
            <td>{{i[2]}}</td>
            <td>{% if i[3]==1 %}<font color="green">登入</font>
                {% elif i[3]==2 %}<font color="green">登出</font>
                {% else %}<font color="blank">操作</font>{% end %}
            </td>
            <td>{% if i[4] %}<font color="green">成功</font>{% else %}<font color="red">失败</font>{% end %}</td>
            <td>{{i[5]}}</td>
        </tr>
        {% end %}
        </tbody>
    </table>
{% end %}
{% block body_js %}
<!--script src="https://cdn.datatables.net/1.10.8/js/jquery.dataTables.min.js"></script-->
<script src="{{ static_url('datatable/jquery.dataTables.min.js') }}"></script>
<script type="text/javascript">
    $(document).ready(function () {
        $('#example').dataTable({
            //"bServerSide":true,//打开服务器模式，数据超过5000条，需要开启这个是最重要的
            "aaSorting": [[ 0, "desc" ]], //设置第一列降序
            "language": {
                "url": "{{static_url('datatable/Chinese.json') }}"  //汉化
            }
        });
    });

</script>

<script type="text/javascript" src="{{ static_url('js/My97DatePicker/WdatePicker.js') }}"></script>
{% end %}
